import pika

# RabbitMQ连接参数
rabbitmq_host = '10.16.152.203'
rabbitmq_port = 5672
rabbitmq_username = 'test'
rabbitmq_password = 'Un9Q4Jxw^D8f'

# 创建连接
credentials = pika.PlainCredentials(rabbitmq_username, rabbitmq_password)
connection = pika.BlockingConnection(pika.ConnectionParameters(host=rabbitmq_host, port=rabbitmq_port, credentials=credentials))

# 创建通道
channel = connection.channel()

# 打印连接成功信息
print("连接RabbitMQ成功")

# 发送消息给 test_queue 队列
channel.basic_publish(exchange='', routing_key='test_aaa', body='Hello World!')


# 关闭连接
connection.close()
